<template>
    <el-dialog width="400px" :visible.sync="isShow" :lock-scroll="true" :title="title" :show-close="true" append-to-body>
        <div style="max-height: 60vh">
            <el-form>
                <el-form-item label="滤波类型">
                    <el-select v-model="form.type">
                        <el-option v-for="i in typeOption" :key="i.value" :label="i.label" :value="i.value"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="窗函数" v-if="chartType == 'fre'">
                    <el-select v-model="form.fun">
                        <el-option v-for="i in funOption" :key="i.value" :label="i.label" :value="i.value"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="谱类型" v-if="chartType == 'fre'">
                    <el-select v-model="form.specType">
                        <el-option v-for="i in freOption" :key="i.value" :label="i.label" :value="i.value"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="高通截止">
                    <el-input-number v-model="form.fmax"></el-input-number>
                </el-form-item>
                <el-form-item label="低通截止">
                    <el-input-number v-model="form.fmin"></el-input-number>
                </el-form-item>
                <el-form-item label="状态">
                    <el-switch v-model="form.status" active-text="开启" inactive-text="关闭">></el-switch>
                </el-form-item>
            </el-form>
        </div>
        <el-button type="primary" @click="onSubmit">提交</el-button>
        <el-button @click="() => (this.isShow = false)">取消</el-button>
    </el-dialog>
</template>
<script>
import { typeOption, freOption, funOption } from './config'
export default {
    data() {
        return {
            isShow: false,
            // 可选值包括 'bandpass', 'bandstop', 'lowpass', 'highpass'。
            title: '滤波',
            typeOption,
            freOption,
            form: {
                status: false,
                type: 'bandpass',
                fmin: 10,
                fmax: 1000,
                fun: 'rectangular',
                specType: 'Ewpk',
            },
            funOption,
            chartType: '',
        }
    },
    props: {
        sensorInfo: {
            type: Object,
            default: null,
        },
    },

    computed: {},
    methods: {
        doOpen(e) {

            this.chartType = e
            this.isShow = true
        },
        onSubmit() {
            this.$emit('getFilter', this.form)
            this.isShow = false
        },
    },
    created() {
        this
    },
}
</script>

<style lang="less" scoped></style>
